function start() {
    action(1, 0, 0);
}

function action(mode, type, selection) {
    var eim = cm.getEventInstance();
    if (eim != null) {
        if (eim.getProperty("leader").equals(cm.getName())) {
            if (cm.haveItem(4001024)) {
                cm.removeAll(4001024);
                var prev = eim.setProperty("bossclear", "true", true);
				var players = eim.getPlayers();
				eim.restartEventTimer(20000);
	           var bonusmap = cm.getMap(990001000);
	           for (var i = 0; i < players.size(); i++) {
	            players.get(i).changeMap(bonusmap, bonusmap.getPortal(0));
	}
                if (prev == null) {
                    var points = 10;
                    cm.gainGP(points);
                }
                eim.finishPQ();
            } else {
                cm.sendOk("这里是最后的挑战了！ 打败黑暗领主之后给我#t4001024#！");
            }
        }
    } else {
        cm.warp(990001100, "st00");
    }
    cm.dispose();
}